package com.cpp.server.tools;

import com.alibaba.fastjson.JSON;
import com.cpp.pojo.vo.summary.ExamReport;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import com.cpp.common.constant.redis.RedisConstant;

import java.util.concurrent.TimeUnit;

@RequiredArgsConstructor
@Slf4j
@Component
@Getter
public class SummaryExamTool {
    private final StringRedisTemplate stringRedisTemplate;
//    private ExamReport examReport = new ExamReport();

    @Tool(description = "生成考试报告")
    public void getKnowledge(
            @ToolParam(description = "考试报告") ExamReport examReports,
            @ToolParam(description = "考试Id") Long examId
    ) {
        //存到redis里
        stringRedisTemplate.opsForValue().set(RedisConstant.EXAM_REPORT_KEY+examId, JSON.toJSONString(examReports),60, TimeUnit.MINUTES);

    }

}
